package ru.papergames.battleserver.network.clientpackets.flashuser;

import ru.papergames.battleserver.network.serverpackets.flashuser.PingResponse;

/**
 * @author Alexander Troshanin
 */
public class PingRequest extends PaperGameClientPacket {

    private int magicNumber;

    @Override
    protected void readImpl() {
        magicNumber = readC();
    }

    @Override
    protected void runImpl() {
        sendPacket(new PingResponse(magicNumber));
        getClient().getUser().setLastPingTime(System.currentTimeMillis());

    }

    @Override
    public String getType() {
        return "[c] PingRequest[" + PING_REQUEST_PACKET_ID + "]";
    }
}
